package com.ithrima.activiti;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;

/**
 *
 *
 *
 *
 *   启动流程实例
 *         在完成部署之后，启动实例
 *
 */
public class ActivitiStatrtInstance {

    public static void main(String[] args) {
        //1. 得到processEngine对象
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        //2. 得到RunService对象
        RuntimeService runtimeService = processEngine.getRuntimeService();
        //3. 创建流程对象
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProcess_1");
        //4. 输出实例相关的信息
        System.out.println("流程部署的ID"+processInstance.getDeploymentId());
        System.out.println("部署流程ID"+processInstance.getProcessDefinitionId());
        System.out.println("流程实例的ID"+processInstance.getId());
        System.out.println("活动的ID"+processInstance.getActivityId());
    }
}
